#include "Factory.h"
#include "Sight.h"
#include "Star.h"
#include "Pipe.h"
#include "Goal.h"

Factory* Factory::instance = 0;

Factory::Factory()
{

}

Factory* Factory::getIns()
{
	if(!instance)
		instance = new Factory();
	return instance;
}

GameObject* Factory::GameObjectMaker(D3DXVECTOR2 pos ,EObjectType type,EState state)
{
	switch(type)
	{
		case EObjectType::EL_Block:
			return new Land(pos,EL_Block);
		case EL_Brick:
			return new Land(pos,EL_Brick);
		case EL_Land1:
			return new Land(pos,EL_Land1);
		case EL_Land2:
			return new Land(pos,EL_Land2);
		case EL_Land3:
			return new Land(pos,EL_Land3);
		case EL_PiPe:
			return new Land(pos,EL_PiPe);
		case EL_BarUp:
			return new Land(pos,EL_BarUp);
		case  EL_BarDown:
			return new Land(pos,EL_BarDown);
		case EBreakBrick:
			return new BreakBrick(pos,state);
		case ECoin:
			return new Coin(pos,state);
		case EFlower:
			return new Flower(pos,state);
		case EFungi:
			return new Fungi(pos,state);
		case ETurtle:
			return new Turtle(pos,state);
		case EMushroom_Red:
			return new MushRoom(pos,EMushroom_Red);
		case EMushroom_Green:
			return new MushRoom(pos, EMushroom_Green);
		case EStar:
			return new Star(pos,state);
		case EQuestionBox:
			return new QuestionBox(pos,state);
		case EQuestionBox_Red:
			return new QuestionBox(pos,EObjectType::EMushroom_Red,state);
		case EQuestionBox_Green:
			return new QuestionBox(pos,EObjectType::EMushroom_Green,state);
		case EQuestionBox_Flower:
			return new QuestionBox(pos,EObjectType::EFlower,state);
		case EQuestionBox_Star:
			return new QuestionBox(pos,EObjectType::EStar,state);
		case EFlowerMonster:
			return new FlowerMonster(pos,state);
		case ECloud:
			return new Sight(pos,ECloud);
		case EGrass:
			return new Sight(pos,EGrass);
		case EFence:
			return new Sight(pos,EFence);
		case EMoutain:
			return new Sight(pos,EMoutain);
		case EPipe_Down:
			return new Pipe(pos,EPipe_Down,state);
		case EPipe_Up:
			return new Pipe(pos,EPipe_Up,state);
		case EPipe_Right:
			return new Pipe(pos,EPipe_Right,state);
		case EPipe_BotTom:
			return new Pipe(pos,EPipe_BotTom,state);
		case EGoal:
			return new Goal(pos);
	}
	return NULL;
}